/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tools.packet;

import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleClient;
import handling.SendPacketOpcode;
import java.awt.Point;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import server.MapleStatInfo;
import server.Randomizer;
import server.ServerProperties;
import tools.FileoutputUtil;
import tools.HexTool;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.data.MaplePacketLittleEndianWriter;

/**
 *
 * @author Itzik
 */
public class JobPacket {

    private static final Logger log = Logger.getLogger(MaplePacketCreator.class);

    public static class PhantomPacket {

        /*
         public static byte[] addStolenSkill(int jobNum, int index, int skill, int level) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.UPDATE_STOLEN_SKILLS.getValue());
         mplew.write(1);
         mplew.write(0);
         mplew.writeInt(jobNum);
         mplew.writeInt(index);
         mplew.writeInt(skill);
         mplew.writeInt(level);
         mplew.writeInt(0);
         mplew.write(0);

         return mplew.getPacket();
         }

         public static byte[] removeStolenSkill(int jobNum, int index) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.UPDATE_STOLEN_SKILLS.getValue());
         mplew.write(1);
         mplew.write(3);
         mplew.writeInt(jobNum);
         mplew.writeInt(index);
         mplew.write(0);

         return mplew.getPacket();
         }

         public static byte[] replaceStolenSkill(int base, int skill) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.REPLACE_SKILLS.getValue());
         mplew.write(1);
         mplew.write(skill > 0 ? 1 : 0);
         mplew.writeInt(base);
         mplew.writeInt(skill);

         return mplew.getPacket();
         }

         public static byte[] gainCardStack(int oid, int runningId, int color, int skillid, int damage, int times) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
         mplew.write(0);
         mplew.writeInt(oid);
         mplew.writeInt(1);
         mplew.writeInt(damage);
         mplew.writeInt(skillid);
         for (int i = 0; i < times; i++) {
         mplew.write(1);
         mplew.writeInt(damage == 0 ? runningId + i : runningId);
         mplew.writeInt(color);
         mplew.writeInt(Randomizer.rand(15, 29));
         mplew.writeInt(Randomizer.rand(7, 11));
         mplew.writeInt(Randomizer.rand(0, 9));
         }
         mplew.write(0);

         return mplew.getPacket();
         }

         public static byte[] updateCardStack(final int total) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.PHANTOM_CARD.getValue());
         mplew.write(total);

         return mplew.getPacket();
         }

         public static byte[] getCarteAnimation(int cid, int oid, int job, int total, int numDisplay) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
         mplew.write(0);
         mplew.writeInt(cid);
         mplew.writeInt(1);

         mplew.writeInt(oid);
         mplew.writeInt(job == 2412 ? 24120002 : 24100003);
         mplew.write(1);
         for (int i = 1; i <= numDisplay; i++) {
         mplew.writeInt(total - (numDisplay - i));
         mplew.writeInt(job == 2412 ? 2 : 0);

         mplew.writeInt(15 + Randomizer.nextInt(15));
         mplew.writeInt(7 + Randomizer.nextInt(5));
         mplew.writeInt(Randomizer.nextInt(4));

         mplew.write(i == numDisplay ? 0 : 1);
         }

         return mplew.getPacket();
         }

         public static byte[] giveAriaBuff(int bufflevel, int buffid, int bufflength) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.DAMAGE_RATE, 0);
         statups.put(MapleBuffStat.DAMAGE_PERCENT, 0);
         PacketHelper.writeBuffMask(mplew, statups);
         for (int i = 0; i < 2; i++) {
         mplew.writeShort(bufflevel);
         mplew.writeInt(buffid);
         mplew.writeInt(bufflength);
         }
         mplew.writeZeroBytes(3);
         mplew.writeShort(0);
         mplew.write(0);
         return mplew.getPacket();
         }
         }

         public static class AngelicPacket {

         public static byte[] showRechargeEffect() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.SHOW_SPECIAL_EFFECT.getValue());
         mplew.write(0x2D);
         return mplew.getPacket();
         }

         public static byte[] RechargeEffect() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.SHOW_SPECIAL_EFFECT.getValue());
         mplew.write(0x2D);
         return mplew.getPacket();
         }

         public static byte[] DressUpTime(byte type) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
         mplew.write(type);
         mplew.writeShort(7707);
         mplew.write(2);
         mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
         return mplew.getPacket();
         }

         public static byte[] updateDress(int transform, MapleCharacter chr) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.ANGELIC_CHANGE.getValue());
         mplew.writeInt(chr.getId());
         mplew.writeInt(transform);
         return mplew.getPacket();
         }

         public static byte[] lockSkill(int skillid) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.LOCK_CHARGE_SKILL.getValue());
         mplew.writeInt(skillid);
         return mplew.getPacket();
         }

         public static byte[] unlockSkill() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.UNLOCK_CHARGE_SKILL.getValue());
         mplew.writeInt(0);
         return mplew.getPacket();
         }

         public static byte[] absorbingSoulSeeker(int characterid, int size, Point essence1, Point essence2, int skillid, boolean creation) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
         mplew.write(!creation ? 0 : 1);
         mplew.writeInt(characterid);
         if (!creation) {
         // false
         mplew.writeInt(3);
         mplew.write(1);
         mplew.write(size);
         mplew.writeZeroBytes(3);
         mplew.writeShort(essence1.x);
         mplew.writeShort(essence1.y);
         mplew.writeShort(essence2.y);
         mplew.writeShort(essence2.x);
         } else {
         // true
         mplew.writeShort(essence1.x);
         mplew.writeShort(essence1.y);
         mplew.writeInt(4);
         mplew.write(1);
         mplew.writeShort(essence1.y);
         mplew.writeShort(essence1.x);
         }
         mplew.writeInt(skillid);
         if (!creation) {
         for (int i = 0; i < 2; i++) {
         mplew.write(1);
         mplew.writeInt(Randomizer.rand(19, 20));
         mplew.writeInt(1);
         mplew.writeInt(Randomizer.rand(18, 19));
         mplew.writeInt(Randomizer.rand(20, 23));
         mplew.writeInt(Randomizer.rand(36, 55));
         mplew.writeInt(540);
         mplew.writeShort(0);//new 142
         mplew.writeZeroBytes(6);//new 143
         }
         } else {
         mplew.write(1);
         mplew.writeInt(Randomizer.rand(6, 21));
         mplew.writeInt(1);
         mplew.writeInt(Randomizer.rand(42, 45));
         mplew.writeInt(Randomizer.rand(4, 7));
         mplew.writeInt(Randomizer.rand(267, 100));
         mplew.writeInt(0);//540
         mplew.writeInt(0);
         mplew.writeInt(0);
         }
         mplew.write(0);
         return mplew.getPacket();
         }

         public static byte[] SoulSeekerRegen(MapleCharacter chr, int sn) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
         mplew.write(1);
         mplew.writeInt(chr.getId());
         mplew.writeInt(sn);
         mplew.writeInt(4);
         mplew.write(1);
         mplew.writeInt(sn);
         mplew.writeInt(65111007); // hide skills
         mplew.write(1);
         mplew.writeInt(Randomizer.rand(0x06, 0x10));
         mplew.writeInt(1);
         mplew.writeInt(Randomizer.rand(0x28, 0x2B));
         mplew.writeInt(Randomizer.rand(0x03, 0x04));
         mplew.writeInt(Randomizer.rand(0xFA, 0x49));
         mplew.writeInt(0);
         mplew.writeLong(0);
         mplew.write(0);
         return mplew.getPacket();
         }

         public static byte[] SoulSeeker(MapleCharacter chr, int skillid, int sn, int sc1, int sc2) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
         mplew.write(0);
         mplew.writeInt(chr.getId());
         mplew.writeInt(3);
         mplew.write(1);
         mplew.writeInt(sn);
         if (sn >= 1) {
         mplew.writeInt(sc1);//SHOW_ITEM_GAIN_INCHAT
         if (sn == 2) {
         mplew.writeInt(sc2);
         }
         }
         mplew.writeInt(65111007); // hide skills
         for (int i = 0; i < 2; i++) {
         mplew.write(1);
         mplew.writeInt(i + 2);
         mplew.writeInt(1);
         mplew.writeInt(Randomizer.rand(0x0F, 0x10));
         mplew.writeInt(Randomizer.rand(0x1B, 0x22));
         mplew.writeInt(Randomizer.rand(0x1F, 0x24));
         mplew.writeInt(540);
         mplew.writeInt(0);//wasshort new143
         mplew.writeInt(0);//new143
         }
         mplew.write(0);
         return mplew.getPacket();
         }*/
    }

    public static class LuminousPacket {//JobPacket.LuminousPacket.

        public static byte[] 夜光_刷新能量(int 黑暗能量, int 光明能量, int 黑暗等级, int 光明等级) {
            if (ServerProperties.ShowPacket()) {
                log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
            }
            //D7 0C 00 00 9C 18 00 00 00 00 00 00 00 00 00 00 8E 72 62 17
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
            mplew.writeShort(SendPacketOpcode.YG_NL.getValue());
            mplew.writeInt(黑暗能量);
            mplew.writeInt(光明能量);
            mplew.writeInt(黑暗等级);
            mplew.writeInt(光明等级);
            mplew.writeInt(392327822);//117=74984423

            return mplew.getPacket();
        }

        public static byte[] 夜光_生命潮汐(int 模式) {
            if (ServerProperties.ShowPacket()) {
                log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            if ((模式 != 1) && (模式 != 2)) {
                模式 = 2;
            }
            mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
            mplew.writeZeroBytes(21);
            mplew.write(32);
            mplew.writeZeroBytes(30);
            mplew.writeShort(模式);
            mplew.writeInt(27110007);
            mplew.writeInt(500645789);
            mplew.writeZeroBytes(5);
            mplew.writeInt(30);
            mplew.writeZeroBytes(14);

            return mplew.getPacket();
        }

        public static byte[] 夜光_黑暗祝福(int 珠子) {
            if (ServerProperties.ShowPacket()) {
                log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
            }

            /*
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 08 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 
            01 00 
            63 83 9D 01 
            3E 7B 7C E8 
            
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            */
            
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

            mplew.writeZeroBytes(21);
            mplew.write(8);
            mplew.writeZeroBytes(30);
            
            mplew.writeShort(珠子);
            mplew.writeInt(27100003);
            mplew.writeInt(-392664763);//117=500119371
            mplew.writeZeroBytes(18);

            return mplew.getPacket();
        }

        public static byte[] 夜光_平衡(int buffid, int 黑暗等级, int 光明等级, int 技能时间, List<Pair<MapleBuffStat, Integer>> statups) {
            if (ServerProperties.ShowPacket()) {
                log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

            PacketHelper.writeBuffMask(mplew, statups);
            for (Pair stat : statups) {
                mplew.writeShort((Integer) stat.getRight());
                mplew.writeInt(20040219);
                mplew.writeInt(技能时间);
            }
            mplew.writeZeroBytes(5);
            mplew.writeInt(20040217);
            mplew.writeInt(726723425);
            mplew.writeInt(20040216);
            mplew.writeInt(275312628);

            mplew.writeInt(2912);

            mplew.writeInt(黑暗等级);
            mplew.writeInt(光明等级);
            mplew.writeInt(0);

            mplew.writeInt(75312628);
            mplew.writeInt(0);
            mplew.writeInt(1000);
            mplew.write(1);
            mplew.writeInt(0);

            return mplew.getPacket();
        }

        public static byte[] 夜光_太阳火焰或月蚀(int buffid, int 黑暗等级, int 光明等级, int 技能时间, List<Pair<MapleBuffStat, Integer>> statups) {
            if (ServerProperties.ShowPacket()) {
                log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
            }

            /*太阳
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 02 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 
            01 00 
            18 CA 31 01 
            00 C2 EB 0B 
            00 00 00 00 00 
            18 CA 31 01 
            43 DF 72 23 
            00 00 00 00 00 00 00 00 
            00 00 00 00 
            E1 00 00 00 
            00 00 00 00 
            00 00 00 00 
            43 1D 87 17 
            00 00 00 00 00 00 00 00 
            01 
            00 00 00 00
            */
            /*月蚀
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 02 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 00 00 00 00 
            00 00 00 00 
            01 00 
            19 CA 31 01 
            00 C2 EB 0B 
            00 00 00 00 00 
            19 CA 31 01 
            86 D8 7B 23 
            00 00 00 00 00 00 00 00 
            AD 00 00 00 
            00 00 00 00 
            01 00 00 00 
            01 00 00 00 
            86 16 90 17 00 00 00 00 00 00 00 00 01 00 00 00 00
            */
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
            
            PacketHelper.writeBuffMask(mplew, statups);
            
            for (Pair stat : statups) {
                mplew.writeShort((Integer) stat.getRight());
                mplew.writeInt(buffid);
                mplew.writeInt(技能时间);
            }
            mplew.writeZeroBytes(5);
            mplew.writeInt(buffid);
            //mplew.writeInt(buffid == 20040216 ? 274782075 : -300459317);//118
            mplew.writeInt(buffid == 20040216 ? -1685989041 : -1685989041);
            mplew.writeLong(0L);
            mplew.writeInt(buffid == 20040217 ? 700 : 0);
            mplew.writeInt(buffid == 20040216 ? 143 : 2949);
            mplew.writeInt(黑暗等级);
            mplew.writeInt(光明等级);
            mplew.writeInt(buffid == 20040216 ? -1885989041: -1885989041);
            mplew.writeLong(0L);
            mplew.write(1);
            mplew.writeInt(0);

            return mplew.getPacket();
        }

        /*
         public static byte[] updateLuminousGauge(int darktotal, int lighttotal, int darktype, int lighttype) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.LUMINOUS_COMBO.getValue());
         mplew.writeInt(darktotal);
         mplew.writeInt(lighttotal);
         mplew.writeInt(darktype);
         mplew.writeInt(lighttype);
         mplew.writeInt(281874974);//1210382225

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] giveLuminousState(int skill, int light, int dark, int duration) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         PacketHelper.writeSingleMask(mplew, MapleBuffStat.LUMINOUS_GAUGE);

         mplew.writeShort(1);
         mplew.writeInt(skill); //20040217
         mplew.writeInt(200000000);
         mplew.writeZeroBytes(5);
         mplew.writeInt(skill); //20040217
         mplew.writeInt(483195070);
         mplew.writeZeroBytes(8);
         mplew.writeInt(Math.max(light, -1)); //light gauge
         mplew.writeInt(Math.max(dark, -1)); //dark gauge
         mplew.writeInt(1);
         mplew.writeInt(1);//was2
         mplew.writeInt(283183599);
         mplew.writeInt(0);
         mplew.writeInt(0);//new143
         mplew.writeInt(1);
         mplew.write(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }*/
    }

    public static class XenonPacket {

        public static byte[] 尖兵能量补给(int 开启能量数量) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            if (ServerProperties.IsLvkejian()) {
                String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵能量补给 --2   \r\n").toString();
                FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
            }
            mplew.writeShort(SendPacketOpcode.XENON_E.getValue());

            mplew.writeZeroBytes(38);
            mplew.writeInt(1);
            mplew.writeZeroBytes(10);

            mplew.writeShort(0x14);

            mplew.writeInt(30020232);
            //mplew.write(HexTool.getByteArrayFromHexString("87 4F 08 F7"));
            mplew.writeInt(-2056147899);

            mplew.writeZeroBytes(18);

            return mplew.getPacket();
        }

        public static byte[] 尖兵能量时间(boolean 状态, int 能量电池最大时间, int 能量电池剩余时间) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            if (ServerProperties.IsLvkejian()) {
                String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵能量时间 --2   \r\n").toString();
                FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
            }

            mplew.writeShort(SendPacketOpcode.XENON_E.getValue());

            mplew.writeZeroBytes(44);
            mplew.writeInt(2);
            mplew.writeInt(0);

            mplew.writeInt(1);

            mplew.writeInt(能量电池最大时间);
            mplew.writeInt(6);
            mplew.writeInt(能量电池剩余时间);

            mplew.writeZeroBytes(18);

            return mplew.getPacket();
        }

        public static byte[] 尖兵开关能量效果(boolean 状态) {
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            if (ServerProperties.IsLvkejian()) {
                String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵开关能量效果 --2   \r\n").toString();
                FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
            }
            mplew.writeShort(SendPacketOpcode.XENON_XG.getValue());

            if (状态 == true) {
                mplew.write(59);
            } else {
                mplew.write(60);
            }

            return mplew.getPacket();
        }

        public static byte[] 尖兵永动机(MapleCharacter chr, List<Pair<MapleBuffStat, Integer>> statups, int bufflenth) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            if (ServerProperties.IsLvkejian()) {
                String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵全息投影 --2   \r\n").toString();
                FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
            }
            mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

            PacketHelper.writeBuffMask(mplew, statups);

            mplew.writeShort(20);
            mplew.writeInt(30020232);
            mplew.writeInt(-65245599);
            mplew.writeShort(1);
            mplew.writeInt(36121054);
            mplew.writeInt(bufflenth);
            mplew.writeZeroBytes(9);
            mplew.writeInt(1000);
            mplew.writeZeroBytes(5);

            return mplew.getPacket();
        }

        public static byte[] 尖兵全息力场(MapleClient c, MapleCharacter chr, Point pos1, Point pos, int skillid, int 技能持续时间, int 技能等级) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.XENON_QXCL.getValue());
            mplew.writeShort(0);
            mplew.writeInt(chr.getId());
            mplew.writeInt(chr.getMapId());
            mplew.writeShort(1);
            mplew.writeInt(1);
            mplew.writeShort(5);
            mplew.writePos(pos1);
            mplew.writePos(pos);
            mplew.writeShort(9);
            mplew.writeInt(技能持续时间);
            mplew.writeShort(10);
            mplew.writeInt(skillid);
            mplew.writeShort(技能等级);
            mplew.write(0);

            return mplew.getPacket();
        }

        public static byte[] 尖兵全息力场_力场_穿透(MapleClient c, MapleCharacter chr, int skillid, int 技能等级, int 未知1, int 未知2) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.XENON_QXCL.getValue());
            mplew.writeShort(0);
            mplew.writeInt(chr.getId());
            mplew.writeInt(chr.getMapId());
            mplew.writeShort(1);
            mplew.writeInt(2);
            mplew.writeShort(4);
            mplew.writePos(chr.getPoss1());
            mplew.writeShort(9);
            mplew.writeInt(100);
            mplew.writeShort(10);
            mplew.writeInt(skillid);
            mplew.writeShort(技能等级);
            mplew.write(0);

            return mplew.getPacket();
        }

        public static byte[] 尖兵全息力场_力场_穿透(MapleClient c, MapleCharacter chr, int skillid, int 数2, int 数1) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.XENON_QXCL.getValue());
            mplew.writeShort(3);
            mplew.writeInt(chr.getId());
            mplew.writeInt(chr.getMapId());
            mplew.writeInt(chr.getId());
            mplew.writeInt(skillid);
            mplew.writeInt(数2);
            mplew.writeInt(数1);

            return mplew.getPacket();
        }

        public static byte[] 尖兵精准火箭(int chrId, int skillId, List<Integer> 打怪ID列表) {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
            mplew.write(0);
            mplew.writeInt(chrId);
            mplew.writeInt(6);
            //mplew.write(0);
            mplew.write(1);
            mplew.writeInt(打怪ID列表.size());
            for (int i = 0; i < 打怪ID列表.size(); i++) {
                mplew.writeInt((打怪ID列表.get(i)));
            }
            mplew.writeInt(skillId);
            for (int i = 2; i <= 5; i++) {
                mplew.write(1);
                mplew.writeLong(i);
                mplew.writeInt(Randomizer.nextInt(100));//255
                mplew.writeInt(Randomizer.nextInt(100));
                mplew.writeInt(Randomizer.nextInt(100));
                mplew.writeInt(Randomizer.nextInt(30000));//之前是30000
                //mplew.writeShort(0);116
                mplew.writeLong(0);
                mplew.writeLong(2059277122);
            }
            mplew.write(0);

            return mplew.getPacket();
        }

        public static byte[] 取消尖兵高能传输() {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

            PacketHelper.writeSingleMask(mplew, MapleBuffStat.尖兵高效输能);
            mplew.writeLong(0L);
            return mplew.getPacket();
        }

        public static byte[] 取消尖兵全息投影() {
            if (ServerProperties.ShowPacket()) {
                log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
            }

            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

            PacketHelper.writeSingleMask(mplew, MapleBuffStat.尖兵全息投影);

            return mplew.getPacket();
        }
    }

    public static class AvengerPacket {

        /*
         public static byte[] giveAvengerHpBuff(int hp) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         PacketHelper.writeSingleMask(mplew, MapleBuffStat.LUNAR_TIDE);
         mplew.writeShort(3);
         mplew.writeInt(0);
         mplew.writeInt(2100000000);
         mplew.writeZeroBytes(5);
         mplew.writeInt(hp);
         mplew.writeZeroBytes(9);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] giveExceed(short amount) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         PacketHelper.writeSingleMask(mplew, MapleBuffStat.EXCEED);

         mplew.writeShort(amount);
         mplew.writeInt(30010230); //skill id
         mplew.writeInt(-1); //duration
         mplew.writeZeroBytes(14);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] giveExceedAttack(int skill, short amount) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         PacketHelper.writeSingleMask(mplew, MapleBuffStat.EXCEED_ATTACK);

         mplew.writeShort(amount);
         mplew.writeInt(skill); //skill id
         mplew.writeInt(15000); //duration
         mplew.writeZeroBytes(14);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] cancelExceed() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.EXCEED, 0);
         statups.put(MapleBuffStat.EXCEED_ATTACK, 0);
         PacketHelper.writeBuffMask(mplew, statups);

         return mplew.getPacket();
         }*/
    }

    public static class DawnWarriorPacket {

        /*
         public static byte[] giveMoonfallStance(int level) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.CRITICAL_PERCENT_UP, 0);
         statups.put(MapleBuffStat.MOON_STANCE2, 0);
         statups.put(MapleBuffStat.WARRIOR_STANCE, 0);
         PacketHelper.writeBuffMask(mplew, statups);

         mplew.writeShort(level);
         mplew.writeInt(11101022);
         mplew.writeInt(Integer.MAX_VALUE);
         mplew.writeShort(1);
         mplew.writeInt(11101022);
         mplew.writeInt(Integer.MAX_VALUE);
         mplew.writeInt(0);
         mplew.write(5);
         mplew.write(1);
         mplew.writeInt(1);
         mplew.writeInt(11101022);
         mplew.writeInt(level);
         mplew.writeInt(Integer.MAX_VALUE);
         mplew.writeInt(0);
         mplew.writeInt(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] giveSunriseStance(int level) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ATTACK_SPEED, 0);
         statups.put(MapleBuffStat.DAMAGE_PERCENT, 0);
         statups.put(MapleBuffStat.WARRIOR_STANCE, 0);
         PacketHelper.writeBuffMask(mplew, statups);

         mplew.writeShort(level);
         mplew.writeInt(11111022);
         mplew.writeInt(Integer.MAX_VALUE);
         mplew.writeInt(0);
         mplew.write(5);
         mplew.write(1);
         mplew.writeInt(1);
         mplew.writeInt(11111022);
         mplew.writeInt(-1);
         mplew.writeInt(Integer.MAX_VALUE);
         mplew.writeInt(0);
         mplew.writeInt(1);
         mplew.writeInt(11111022);
         mplew.writeInt(0x19);
         mplew.writeInt(Integer.MAX_VALUE);
         mplew.writeInt(0);
         mplew.writeInt(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] giveEquinox_Moon(int level, int duration) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.CRITICAL_PERCENT_UP, 0);
         statups.put(MapleBuffStat.MOON_STANCE2, 0);
         statups.put(MapleBuffStat.EQUINOX_STANCE, 0);
         PacketHelper.writeBuffMask(mplew, statups);

         mplew.writeShort(level);
         mplew.writeInt(11121005);
         mplew.writeInt(duration);
         mplew.writeShort(1);
         mplew.writeInt(11121005);
         mplew.writeInt(duration);
         mplew.writeInt(0);
         mplew.write(5);
         mplew.writeInt(1);
         mplew.writeInt(11121005);
         mplew.writeInt(level);
         mplew.writeInt(duration);
         mplew.writeInt(duration);
         mplew.writeInt(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] giveEquinox_Sun(int level, int duration) {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ATTACK_SPEED, 0);
         statups.put(MapleBuffStat.DAMAGE_PERCENT, 0);
         statups.put(MapleBuffStat.EQUINOX_STANCE, 0);
         PacketHelper.writeBuffMask(mplew, statups);

         mplew.writeShort(level);
         mplew.writeInt(11121005);
         mplew.writeInt(duration);
         mplew.writeInt(0);
         mplew.write(5);
         mplew.writeInt(1);
         mplew.writeInt(11121005);
         mplew.writeInt(-1);
         mplew.writeInt(duration);
         mplew.writeInt(duration);
         mplew.writeInt(1);
         mplew.writeInt(11121005);
         mplew.writeInt(0x19);
         mplew.writeInt(duration);
         mplew.writeInt(duration);
         mplew.writeInt(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }*/
    }

    public static class BeastTamerPacket {

        /*
         public static byte[] ModeCancel() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ANIMAL_SELECT, 0);
         PacketHelper.writeBuffMask(mplew, statups);

         return mplew.getPacket();
         }

         public static byte[] BearMode() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ANIMAL_SELECT, 0);
         PacketHelper.writeBuffMask(mplew, statups);
         mplew.writeShort(1);
         mplew.writeInt(110001501);
         mplew.writeInt(-419268850);
         mplew.writeLong(0);
         mplew.writeInt(0);
         mplew.write(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] LeopardMode() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ANIMAL_SELECT, 0);
         PacketHelper.writeBuffMask(mplew, statups);
         mplew.writeShort(2);
         mplew.writeInt(110001502);
         mplew.writeInt(-419263978);
         mplew.writeLong(0);
         mplew.writeInt(0);
         mplew.write(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] HawkMode() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ANIMAL_SELECT, 0);
         PacketHelper.writeBuffMask(mplew, statups);
         mplew.writeShort(3);
         mplew.writeInt(110001503);
         mplew.writeInt(-419263978);
         mplew.writeLong(0);
         mplew.writeInt(0);
         mplew.write(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] CatMode() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.ANIMAL_SELECT, 0);
         PacketHelper.writeBuffMask(mplew, statups);
         mplew.writeShort(4);
         mplew.writeInt(110001504);
         mplew.writeInt(-419263978);
         mplew.writeLong(0);
         mplew.writeInt(0);
         mplew.write(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }

         public static byte[] LeopardRoar() {
         MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

         mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

         Map<MapleBuffStat, Integer> statups = new EnumMap<>(MapleBuffStat.class);
         statups.put(MapleBuffStat.DAMAGE_CAP_INCREASE, statups.get(MapleStatInfo.indieDamR));
         statups.put(MapleBuffStat.DAMAGE_PERCENT, statups.get(MapleStatInfo.indieMaxDamageOver));
         PacketHelper.writeBuffMask(mplew, statups);
         mplew.writeShort(4);
         mplew.writeInt(110001504);
         mplew.writeInt(-419263978);
         mplew.writeLong(0);
         mplew.writeInt(0);
         mplew.write(0);
         mplew.write(1);
         mplew.writeInt(0);

         mplew.writeZeroBytes(69); //for no dc

         return mplew.getPacket();
         }*/
    }
}
